#include "abcdialog.h"
#include "common/common.h"

#define ABCDIALOG_HEIGHT 64*SCREEN_HIGH/480

ABCDialog::ABCDialog(QWidget *parent) :
    TDialog(parent)
{
    this->setFixedSize(ABCDIALOG_HEIGHT,ABCDIALOG_HEIGHT);
    this->setStyleSheet("TDialog {background-color: rgba(150,45,59,128)}");
    mChar = 'B';
}


void ABCDialog::paintEvent(QPaintEvent *event)
{
    Q_UNUSED(event);
    QPainter painter(this);
    painter.save();
    OnDrawContent(painter);
    painter.restore();
}

void ABCDialog::OnDrawContent(QPainter &painter)
{
    QFont font("DejaVu Sans",26,QFont::Bold);
    painter.setFont(font);
    QRect rect = this->rect();
    QString string = QString(mChar);
//    painter.fillRect(rect,QColor(0X38,0X3A, 0X3C, 136));
//    painter.setPen(QColor(255,255,255));
//    painter.drawRect(rect);
    painter.drawText(rect,Qt::AlignCenter,string);
}



void ABCDialog::UpdateChar(QChar c)
{
    mChar = c;
    update();
}


